package EX3;

import java.io.*;

/*
BufferedReader类 和 BufferedWriter类
带缓冲区的字符输入流、输出流（必须要刷新flush()、关闭流）
 */
public class demo6 {
    public static void main(String[] args) throws IOException {
        File f=new File("C:/filea/a.txt");
        BufferedReader br=new BufferedReader(new FileReader(f));
        String c=br.readLine();
        while (c!=null){
            System.out.println(c);
            c=br.readLine();
        }

        BufferedWriter bw=new BufferedWriter(new FileWriter(f));
        bw.write("哈哈哈哈");
        bw.newLine();
        bw.write("最后一行");
        bw.flush();
        bw.close();
    }
}
